from rest_framework import serializers

from goods.models import SpecificationOption


class OptionsSerializer(serializers.ModelSerializer):

    # 关联嵌套序列化返回
    spec = serializers.StringRelatedField(read_only=True)
    spec_id = serializers.IntegerField()

    class Meta:
        model = SpecificationOption
        fields = ('value','spec','id','spec_id')

"""

            "id": "选项id",
            "value": "选项名称",
            "spec": "规格名称",
            "spec_id": "规格id"

"""




